<include file="application/walletyhbbadmin/view/public/left.html"/>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/kindeditor/kindeditor.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/kindeditor/plugins/prettify.js"></script>
<div id="dcMain">
   <!-- 当前位置 -->
    <script>
        function checkForm(){
            editor.sync();
            var name = document.getElementById('title').value;

            if(name != ""){
                document.getElementById('myform').submit();
            }else{
                alert('请填写标题');
            }
        }
    </script>
    <style type="text/css">
        .del_style{ margin-left: 5px; margin-top: 5px; font-size: 20px;}
    </style>
    <style type="text/css">
        .previewImg{
            height:200px;
            width:auto;
            margin:15px 15px;
        }
        .closeImg{
            width:20px;
            height:20px;
            border-radius:20px;
            background-color:rgb(100,100,255);
            color:white;
            text-align:center;
            display:inline-block;
            position:relative;
            top:-100px;
            left:-10px;
            cursor:pointer;
            padding:none;
        }
        .closeImg:hover{
            width:20px;
            height:20px;
            border-radius:20px;
            background-color:rgb(255,100,100);
            color:white;
            text-align:center;
            display:inline-block;
            position:relative;
            top:-100px;
            left:-10px;
            cursor:pointer;
        }
        .contact-form div{ padding:0}
    </style>
<div id="urHere">管理中心<b>></b><strong>添加库存</strong> </div>   <div class="mainBox" style="height:auto!important;height:550px;min-height:550px;">
            <h3><a href="{:U('Goods/lists')}" class="actionBtn">浏览商品</a>库存管理</h3>
    <table  width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
        <tr>
            <th>商品颜色</th>
            <th>商品型号</th>
            <th>商品库存</th>
            <th>商品金额</th>
            <th>商品状态</th>
            <th>操作</th>
        </tr>
        <volist name='stock' id='vs'>
            <tr>
                <td align="center" style="width:100px;word-break:break-all;">{$vs.color}</td>
                <td align="center" style="width:100px;word-break:break-all;">{$vs.label}</td>
                <td align="center" style="width:100px;word-break:break-all;">{$vs.num}</td>
                <td align="center" style="width:100px;word-break:break-all;">{$vs.price}</td>
                <td align="center" style="width:100px;word-break:break-all;">
                    <if condition="$vs.status eq 1">启用</if>
                    <if condition="$vs.status eq 0">禁用</if>
                </td>
                <td align="center" style="width:100px;word-break:break-all;">
                    <a class="btn btn6" href="{:U('Goods/updatestock',array('goods_id'=>$vs['id']))}">修改商品库存信息</a>
                    &nbsp;
<!--                    <a href="{:U('Goods/webDel',array('goods_id'=>$vo['goods_id']))}" onClick="javascript:if(!confirm('确定要删除吗？'))  return  false;">删除</a>-->
<!--                    &nbsp;-->

                </td>
            </tr>
        </volist>

    </table>

    <form action="{:U('Goods/addstock')}" method="post" id="myform" name="myform" enctype="multipart/form-data" >
        <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
            <tbody>
            <input type="hidden" id="id" name="goods_id" value="{$good.goods_id}">
            <tr>
                <td width="6%" align="right">商品名称</td>
                <td>
                    <input type="text" name="goods_name" id="name" required value="{$good.goods_name}" size="50" class="inpMain" disabled />
                </td>
            </tr>

            <foreach name="label" item="vv">
                <tr>
                    <th><i class="require-red"></i>{$vv}：</th>
                    <td>
                        <a href="#" class="btn btn-info AddMoreFileBox" data-key="{$vv}">添加颜色库存及价格</a><br>
                        <div class="InputsWrapper">
                        </div>
                    </td>
                </tr>
            </foreach>

            <tr>
                <th></th>
                <td>
                    <input class="btn btn-primary btn6 mr10" value="提交"  type="submit" >
<!--                    <input class="btn btn6" onclick="history.go(-1)"  type="reset">-->
                    <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                </td>
            </tr>
            </tbody>
        </table>
    </form>
       </div>
 </div>
 <div class="clear"></div>
<include file="application/walletyhbbadmin/view/public/foot.html"/><!-- dcFooter 结束 -->
<div class="clear"></div> </div>
 <script type="text/javascript">

 onload = function()
 {
   document.forms['action'].reset();
 }

 function douAction()
 {
     var frm = document.forms['action'];

     frm.elements['new_cat_id'].style.display = frm.elements['action'].value == 'category_move' ? '' : 'none';
 }

 </script>

<script>
    function quanxuan(){
        $(".xuanzhong").prop("checked",true);
    }
    function buxuan(){
        $(".xuanzhong").prop("checked",false);
    }

    function add(ev) {
        var copyer=$(ev).parent().clone();             // 设置一个变量等于要拷贝的内容,找到此标签的父级,clone()克隆.
        copyer.children(":button").attr("value","－").attr("onclick","del(this)"); //按设定需求 把克隆内容里的value和onclick事件改变
        copyer.children(":text").val(""); //
        $("#qqb").append(copyer);                      // 或者用$("#outer").append(copyer); 一个是找到兄弟的加入同级标签,一个是找到父级标签
    }

    function del(ev) {
        $(ev).parent().remove()
    }

    function add1(ev1) {
        var copyer=$(ev1).parent().clone();             // 设置一个变量等于要拷贝的内容,找到此标签的父级,clone()克隆.
        copyer.children(":button").attr("value","－").attr("onclick","del1(this)"); //按设定需求 把克隆内容里的value和onclick事件改变
        copyer.children(":text").val(""); //
        $("#bbq").append(copyer);                      // 或者用$("#outer").append(copyer); 一个是找到兄弟的加入同级标签,一个是找到父级标签
    }

    function del1(ev1) {
        $(ev1).parent().remove()
    }
</script>
<script>
    $(".sub-menu").eq(2).show();
    $(".sub-menu").eq(2).children("li").eq(0).addClass("on");
</script>


<script>
    $(document).ready(function() {
        var InputsWrapper   = $(".InputsWrapper");
        var AddButton       = $(".AddMoreFileBox");

        var x = InputsWrapper.length;
        var FieldCount=0;

        $(AddButton).click(function (e)
        {
            var type = $(this).data("key");
            FieldCount++;
            $(this).siblings(".InputsWrapper").append('<div>颜色：<input class="common-text" type="text" name="'+type+'color[]" />数量：<input class="common-text" type="text" name="'+type+'num[]" value=""/>商品金额：<input class="common-text" type="text" name="'+type+'price[]" value=""/><a href="#" class="removeclass del_style">×</a></div>');
            x++;
            return false;
        });

        $("body").on("click",".removeclass", function(e){
            if( x > 1 ) {
                $(this).parent('div').remove();
                x--;
            }
            return false;
        })

    });
</script>
</body>
</html>